/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.hpvas.gui.internalframe;

import edu.hpvas.control.OwnerController;
import edu.hpvas.control.PetController;
import edu.hpvas.control.Restrictions;
import edu.hpvas.persistence.entity.Owner;
import edu.hpvas.persistence.entity.Pet;
import java.awt.Color;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;

/**
 *
 * @author sony
 */
public class PetCreateFrame extends javax.swing.JInternalFrame {

     OwnerController ownerC= new OwnerController();
     PetController petC = new PetController();
     Owner owner = new Owner();
     Restrictions restric = new Restrictions();
     ArrayList<Owner> owners = new ArrayList<>();
     String path= "";
    /**
     * Creates new form PetCreateFrame
     */
    public PetCreateFrame() {
        initComponents();
        int ancho=710;
        int alto=450;
        setSize(ancho, alto);
        initInternalFrame();
        petPanelJP.setVisible(false);
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        petPanelJP = new javax.swing.JPanel();
        nameJL = new javax.swing.JLabel();
        ageJL = new javax.swing.JLabel();
        speciesJL = new javax.swing.JLabel();
        weigthJL = new javax.swing.JLabel();
        nameJT = new javax.swing.JTextField();
        speciesJT = new javax.swing.JTextField();
        ageJT = new javax.swing.JTextField();
        weithJT = new javax.swing.JTextField();
        fileJL = new javax.swing.JLabel();
        fileJT = new javax.swing.JTextField();
        searchFileJB = new javax.swing.JButton();
        caractersJL = new javax.swing.JLabel();
        addJB = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        nameJCB = new javax.swing.JComboBox();
        SelectJB = new javax.swing.JButton();
        errorJL = new javax.swing.JLabel();
        nameJTF = new javax.swing.JTextField();

        petPanelJP.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Pet Information", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        nameJL.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        nameJL.setText("Name");

        ageJL.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ageJL.setText("Age");

        speciesJL.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        speciesJL.setText("Species");

        weigthJL.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        weigthJL.setText("Weight");

        nameJT.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                nameJTMouseClicked(evt);
            }
        });

        speciesJT.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                speciesJTMouseClicked(evt);
            }
        });

        ageJT.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ageJTMouseClicked(evt);
            }
        });

        weithJT.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                weithJTMouseClicked(evt);
            }
        });

        fileJL.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        fileJL.setText("File");

        fileJT.setEditable(false);

        searchFileJB.setText("Search");
        searchFileJB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                searchFileJBActionPerformed(evt);
            }
        });

        caractersJL.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        caractersJL.setForeground(new java.awt.Color(255, 0, 0));
        caractersJL.setText("The special caracters are not allowed... try again");

        addJB.setText("add");
        addJB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addJBActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout petPanelJPLayout = new javax.swing.GroupLayout(petPanelJP);
        petPanelJP.setLayout(petPanelJPLayout);
        petPanelJPLayout.setHorizontalGroup(
            petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(petPanelJPLayout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(petPanelJPLayout.createSequentialGroup()
                        .addComponent(weigthJL)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(weithJT, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(petPanelJPLayout.createSequentialGroup()
                        .addComponent(nameJL)
                        .addGap(18, 18, 18)
                        .addComponent(nameJT, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(petPanelJPLayout.createSequentialGroup()
                        .addGroup(petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(speciesJL)
                            .addComponent(ageJL))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ageJT, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(speciesJT, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(petPanelJPLayout.createSequentialGroup()
                        .addGap(15, 15, 15)
                        .addComponent(fileJL)
                        .addGap(18, 18, 18)
                        .addComponent(fileJT, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(36, 36, 36)
                        .addComponent(searchFileJB, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(petPanelJPLayout.createSequentialGroup()
                .addGap(64, 64, 64)
                .addComponent(caractersJL, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(addJB)
                .addGap(42, 42, 42))
        );
        petPanelJPLayout.setVerticalGroup(
            petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(petPanelJPLayout.createSequentialGroup()
                .addGroup(petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nameJL)
                    .addComponent(nameJT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(speciesJL)
                    .addComponent(speciesJT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ageJL)
                    .addComponent(ageJT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(weigthJL)
                    .addComponent(weithJT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(petPanelJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(fileJL)
                    .addComponent(fileJT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(searchFileJB))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
                .addComponent(caractersJL))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, petPanelJPLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(addJB)
                .addContainerGap())
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Owner", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(102, 0, 0)));

        jLabel6.setText("To create a Pet, you must fix it an owner");

        jLabel7.setText("Search by name & Last Name");

        jButton1.setText("Enter");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        SelectJB.setText("Select");
        SelectJB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SelectJBActionPerformed(evt);
            }
        });

        errorJL.setForeground(new java.awt.Color(204, 0, 0));
        errorJL.setText("The special caracters are not allowed... try again");

        nameJTF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                nameJTFMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel6))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGap(8, 8, 8)
                                        .addComponent(errorJL, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(nameJTF, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jButton1)))
                                .addGap(11, 11, 11))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(33, 33, 33)
                                .addComponent(nameJCB, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGap(18, 18, 18)
                                .addComponent(SelectJB, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(56, 56, 56))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel6)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(nameJTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton1))
                        .addGap(8, 8, 8)
                        .addComponent(errorJL)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(nameJCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(SelectJB)))))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(petPanelJP, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(petPanelJP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        errorJL.setVisible(false);
        nameJCB.removeAllItems();
        if(nameJTF.getText().equals("") || nameJTF.getText().equals("The field Cannot be Blank")){
            nameJTF.setText("The field Cannot be Blank");
            nameJTF.setForeground(Color.red);
        }
        else if(!restric.validateSpecialC(nameJTF.getText())){
            errorJL.setVisible(true);
        }
        else{
            owners = ownerC.searchOwners(nameJTF.getText());
            if(!owners.isEmpty()){
                nameJCB.addItem("-----------");
                nameJCB.setVisible(true);
                SelectJB.setVisible(true);
                for(Owner o:owners){
                    nameJCB.addItem(o.getIdPerson().getName() + " " + o.getIdPerson().getLastName());
                }

            }
            else{
                nameJCB.setVisible(false);
                SelectJB.setVisible(false);
            }
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void SelectJBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SelectJBActionPerformed
        if(nameJCB.getSelectedIndex()!=0){
            owner = owners.get(nameJCB.getSelectedIndex()-1);
            nameJTF.setText("");
            nameJCB.removeAll();
            nameJCB.setVisible(false);
            SelectJB.setVisible(false);
            initPetInfo();
        }
    }//GEN-LAST:event_SelectJBActionPerformed

    private void nameJTFMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nameJTFMouseClicked

        if(nameJTF.getText().equals("The field Cannot be Blank")){
            nameJTF.setText("");
            nameJTF.setForeground(Color.black);
        }
    }//GEN-LAST:event_nameJTFMouseClicked

    private void searchFileJBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchFileJBActionPerformed
         JFileChooser fileChoserJF = new JFileChooser();
         fileChoserJF.setVisible(true);
         fileChoserJF.setFileFilter(new FileNameExtensionFilter("all images", "png","PNG","jpg","JPG"));
         fileChoserJF.showOpenDialog(fileChoserJF);
         fileJT.setText(fileChoserJF.getSelectedFile().getName());
         path=fileChoserJF.getSelectedFile().getAbsolutePath();
    }//GEN-LAST:event_searchFileJBActionPerformed

    private void addJBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addJBActionPerformed
        
        if(nameJT.getText().isEmpty()|| speciesJT.getText().isEmpty() || ageJT.getText().isEmpty()
                ||weithJT.getText().isEmpty()||
                nameJT.getText().equals("The name field cannot be Blank") ||
                speciesJT.getText().equals("The species field cannot be Blank")||
                ageJT.getText().equals("The age cannot be Blank") ||
                weithJT.getText().equals("The weigh cannot be Blank")){
            
            if(nameJT.getText().isEmpty()){
                nameJT.setText("The name field cannot be Blank");
                nameJT.setForeground(Color.red);
            }
            if(speciesJT.getText().isEmpty()){
                speciesJT.setText("The species field cannot be Blank");
                speciesJT.setForeground(Color.red);
            }
            if(ageJT.getText().isEmpty()){
                ageJT.setText("The age cannot be Blank");
                ageJT.setForeground(Color.red);
            }
            if(weithJT.getText().isEmpty()){
                weithJT.setText("The weigh cannot be Blank");
                weithJT.setForeground(Color.red);
            }
        }
        else{
            Pet pet = new Pet();
            pet.setAge(new Integer(ageJT.getText()));
            pet.setName(nameJT.getText());
            pet.setSpecies(speciesJT.getText());
            pet.setWight(new Float (weithJT.getText()));
            File file = new File(path);
            FileInputStream fileInput = null;
            try {
                fileInput = new FileInputStream(file);
            } catch (FileNotFoundException ex) {
                JOptionPane.showMessageDialog(this, "Add an image!");
                Logger.getLogger(PetCreateFrame.class.getName()).log(Level.SEVERE, null, ex);
            }
            byte contenido[] = new byte[(int)file.length()]; 
            try {
                fileInput.read(contenido);
            } catch (IOException ex) {
                Logger.getLogger(PetCreateFrame.class.getName()).log(Level.SEVERE, null, ex);
            }
            pet.setPicture(contenido);
            petC.createPet(owner, pet);
            JOptionPane.showMessageDialog(this, "The  pet was create");
            
        }

    }//GEN-LAST:event_addJBActionPerformed

    private void nameJTMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nameJTMouseClicked
        
        if(nameJT.getText().equals("The name field cannot be Blank")){
            nameJT.setText("");
            nameJT.setForeground(Color.black);
        }

    }//GEN-LAST:event_nameJTMouseClicked

    private void speciesJTMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_speciesJTMouseClicked
        
        if(speciesJT.getText().equals("The species field cannot be Blank")){
            speciesJT.setText("");
            speciesJT.setForeground(Color.black);
        }
    }//GEN-LAST:event_speciesJTMouseClicked

    private void ageJTMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ageJTMouseClicked
        if(ageJT.getText().equals("The age cannot be Blank")){
            ageJT.setText("");
            ageJT.setForeground(Color.black);
        }
    }//GEN-LAST:event_ageJTMouseClicked

    private void weithJTMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_weithJTMouseClicked
        if(weithJT.getText().equals("The weigh cannot be Blank")){
            weithJT.setText("");
            weithJT.setForeground(Color.black);
        }

    }//GEN-LAST:event_weithJTMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton SelectJB;
    private javax.swing.JButton addJB;
    private javax.swing.JLabel ageJL;
    private javax.swing.JTextField ageJT;
    private javax.swing.JLabel caractersJL;
    private javax.swing.JLabel errorJL;
    private javax.swing.JLabel fileJL;
    private javax.swing.JTextField fileJT;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JComboBox nameJCB;
    private javax.swing.JLabel nameJL;
    private javax.swing.JTextField nameJT;
    private javax.swing.JTextField nameJTF;
    private javax.swing.JPanel petPanelJP;
    private javax.swing.JButton searchFileJB;
    private javax.swing.JLabel speciesJL;
    private javax.swing.JTextField speciesJT;
    private javax.swing.JLabel weigthJL;
    private javax.swing.JTextField weithJT;
    // End of variables declaration//GEN-END:variables

    private void initInternalFrame() {
        errorJL.setVisible(false);
        caractersJL.setVisible(false);
        petPanelJP.setVisible(false);
    }

    private void initPetInfo() {
        
        petPanelJP.setVisible(true);
    }
}
